<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>util</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="tennisScore-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            >tennisScore</th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Module&nbsp;util
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="util-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module util</h1><p class="nomargin-top"><span class="codelink"><a href="util-pysrc.html">source&nbsp;code</a></span></p>
<p>util.py</p>
  <p>Copyright 2014, Ty A. Lasky</p>
  <p>Released under the GNU General Public License 3.0</p>
  <p>See LICENSE.txt for license information.</p>
  <p>---------------------------------------------------</p>
  <p>Utility routines for tennisScore.py.</p>

<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Functions</span></td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="util-module.html#center" class="summary-sig-name">center</a>(<span class="summary-sig-arg">win</span>)</span><br />
      Centers a window on the screen.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="util-pysrc.html#center">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">tuple</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="util-module.html#centerCoords" class="summary-sig-name">centerCoords</a>(<span class="summary-sig-arg">win</span>)</span><br />
      Returns x,y coordinates that would center a window.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="util-pysrc.html#centerCoords">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="util-module.html#positionWindow" class="summary-sig-name">positionWindow</a>(<span class="summary-sig-arg">win</span>,
        <span class="summary-sig-arg">x</span>,
        <span class="summary-sig-arg">y</span>)</span><br />
      Positions a window at given coordinates.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="util-pysrc.html#positionWindow">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">string</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="util-module.html#getUrlAsString" class="summary-sig-name">getUrlAsString</a>(<span class="summary-sig-arg">url</span>)</span><br />
      Returns the contents of the given URL as a single string.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="util-pysrc.html#getUrlAsString">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">iterator</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="util-module.html#lineIter" class="summary-sig-name">lineIter</a>(<span class="summary-sig-arg">s</span>)</span><br />
      Provides a line iterator for a string.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="util-pysrc.html#lineIter">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">string</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="util-module.html#decode" class="summary-sig-name">decode</a>(<span class="summary-sig-arg">bytes</span>)</span><br />
      Decodes a given list of bytes as UTF-8.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="util-pysrc.html#decode">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="util-module.html#dbgprint" class="summary-sig-name">dbgprint</a>(<span class="summary-sig-arg">debug</span>,
        <span class="summary-sig-arg">s</span>)</span><br />
      Prints a string if debug boolean is true.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="util-pysrc.html#dbgprint">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Variables</span></td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="py"></a><span class="summary-name">py</span> = <code title="2">2</code>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="__package__"></a><span class="summary-name">__package__</span> = <code title="None">None</code>
    </td>
  </tr>
</table>
<p class="indent-wrapped-lines"><b>Imports:</b>
  <span title="tkinter">tk</span>,
  <span title="urllib">urllib</span>
</p><br />
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Function Details</span></td>
</tr>
</table>
<a name="center"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">center</span>(<span class="sig-arg">win</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="util-pysrc.html#center">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Centers a window on the screen.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>win</code></strong> (Toplevel widget) - Window to be centered.</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="centerCoords"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">centerCoords</span>(<span class="sig-arg">win</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="util-pysrc.html#centerCoords">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Returns x,y coordinates that would center a window.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>win</code></strong> (Toplevel widget) - Window to be centered.</li>
    </ul></dd>
    <dt>Returns: tuple</dt>
        <dd>Tuple of (x,y) coordinates to center the window.</dd>
  </dl>
</td></tr></table>
</div>
<a name="positionWindow"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">positionWindow</span>(<span class="sig-arg">win</span>,
        <span class="sig-arg">x</span>,
        <span class="sig-arg">y</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="util-pysrc.html#positionWindow">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Positions a window at given coordinates.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>win</code></strong> (Toplevel widget) - Window to be centered.</li>
        <li><strong class="pname"><code>x</code></strong> (int) - x-coordinate for window position.</li>
        <li><strong class="pname"><code>y</code></strong> (int) - y-coordinate for window position.</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="getUrlAsString"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">getUrlAsString</span>(<span class="sig-arg">url</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="util-pysrc.html#getUrlAsString">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Returns the contents of the given URL as a single string.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>url</code></strong> (string) - The URL to be converted to a string.</li>
    </ul></dd>
    <dt>Returns: string</dt>
        <dd>The contents of the URL as a string.</dd>
  </dl>
</td></tr></table>
</div>
<a name="lineIter"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">lineIter</span>(<span class="sig-arg">s</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="util-pysrc.html#lineIter">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Provides a line iterator for a string.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>s</code></strong> (string) - Multi-line string to iterate over.</li>
    </ul></dd>
    <dt>Returns: iterator</dt>
        <dd>Line iterator for a string.</dd>
  </dl>
</td></tr></table>
</div>
<a name="decode"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">decode</span>(<span class="sig-arg">bytes</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="util-pysrc.html#decode">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Decodes a given list of bytes as UTF-8.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>bytes</code></strong> (list of bytes)</li>
    </ul></dd>
    <dt>Returns: string</dt>
        <dd>A decoded version of the input bytes.</dd>
  </dl>
</td></tr></table>
</div>
<a name="dbgprint"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">dbgprint</span>(<span class="sig-arg">debug</span>,
        <span class="sig-arg">s</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="util-pysrc.html#dbgprint">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Prints a string if debug boolean is true.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>debug</code></strong> (boolean) - Flag, true if string should be printed.</li>
        <li><strong class="pname"><code>s</code></strong> (string) - String to be printed.</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="tennisScore-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            >tennisScore</th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Sun Nov  9 17:23:05 2014
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
